import 'package:fate_blind_box/utils/common_widget.dart';
import 'package:fate_blind_box/widget/common_empty_view.dart';
import 'package:flutter/cupertino.dart';
import 'act_sign_item_controller.dart';
import 'act_sign_item_view.dart';
import 'package:get/get.dart';

class ActSignUpListPage extends StatefulWidget {
  String actId = '';

  ActSignUpListPage({this.actId = '', Key? key}) : super(key: key);

  @override
  State<ActSignUpListPage> createState() => _ActSignUpListPageState();
}

class _ActSignUpListPageState extends State<ActSignUpListPage> {
  ActSignItemController signItemController = Get.put(ActSignItemController());

  @override
  Widget build(BuildContext context) {
    return AppWidget.navTitleBar(
      title: '报名列表',
      childWidget: GetBuilder(
          id: signItemController.signListViewId,
          builder: (ActSignItemController controller) {
            return controller.dataList.isEmpty
                ? Offstage(
                    offstage: controller.dataList.isNotEmpty,
                    child: const CommonEmptyView())
                : ListView.builder(
                    itemCount: controller.dataList.length,
                    itemBuilder: (BuildContext context, int index) {
                      return ActSignItemView(
                        signUpListDataModel: controller.dataList[index],
                      );
                    });
          }),
    );
  }

  @override
  void initState() {
    super.initState();
    signItemController.getListData(widget.actId);
  }
}
